package com.yeswater.multithread.chapter7;

import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * author : yeswater
 * date : 2023/11/6
 *
 * SimpleDateFormat 非线程安全
 */

public class Run_7_6_0 {
    public static void main(String[] args) throws ParseException {
        String date1 = "2000-1-1";
        String date2 = "2000-11-19";
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-M-d");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");

        System.out.println(sdf1.format(sdf1.parse(date1)));
        System.out.println(sdf2.format(sdf2.parse(date1)));
        System.out.println();
        System.out.println(sdf1.format(sdf1.parse(date2)));
        System.out.println(sdf2.format(sdf2.parse(date2)));
    }
}
